package wsz.spring;


import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.List;

@Aspect
@Component("loggingAspect")
public class LoggingAspect {

    @Before("execution(* wsz.spring.service.*.*(..))")
    public void beforeMethod(JoinPoint joinPoint){
        String methodName = joinPoint.getSignature().getName();
        List<Object> list = Arrays.asList(joinPoint.getArgs());
        System.out.println("list#############");
        System.out.println(list);
        System.out.println("methodName############");
        System.out.println(methodName);
        System.out.println("before");
    }

    public void afterMethod(){
        System.out.println("after");
    }
}